"""teachzero URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.2/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import include, path, re_path
from django.conf import settings
from django.conf.urls.static import static
import teach
import blog
import tool
import exam
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

urlpatterns = [
    path("", include("home.urls")),
    path("admin/", admin.site.urls),
    path("tool/", include("tool.urls")),
    path("blog/", include("blog.urls")),
    path("teach/", include("teach.urls")),
    path("exam/",include(("exam.urls", "exam"), namespace="exam")),
    path('FileManage/',include(("FileManage.urls", "FileManage"), namespace="FileManage")),
    path("mdeditor/", include("mdeditor.urls")),  # mdeditor编辑器上传图片用
    path("item/<url>", teach.views.item_detail, name="item_detail"),  # 获取课程或者练习
    path("blog/<url>", blog.views.blog_detail, name="blog_detail"),  # 获取博客详情
    path("update", blog.views.update_log, name="update_log"),  # 获取更新详情
    re_path(
        r"^delete/(?P<url>.*)/$", tool.views.delete, name="delete_share"
    ),  # 删除共享的文件
    path("service/", include("service.urls")),
]

urlpatterns += staticfiles_urlpatterns()  # gunicorn部署静态文件支持
if settings.DEBUG:
    # static files (images, css, javascript, etc.)
    urlpatterns += static(settings.MEDIA_URL,
                          document_root=settings.MEDIA_ROOT)
